package main;


public class Particles {
	private int numberOfParticles;
	private int dimensions;
	
	private double[][] positions;
	private double[][] velocities;
	private double[] masses;
	private double[] charges;
	
	public Particles(int dimensions,int numberOfParticles,double[][] positions,double[][] velocities,double[] charges,double[] masses){
		this.setDimensions(dimensions);
		this.setNumberOfParticles(numberOfParticles);
		this.setPositions(positions);
		this.setVelocities(velocities);
		this.setCharges(charges);
		this.setMasses(masses);
	}
	
	public Particles(){
		this.setDimensions(2);
		this.setNumberOfParticles(3);
		
		this.positions = new double[this.numberOfParticles][this.dimensions];
		this.velocities = new double[this.numberOfParticles][this.dimensions];
		this.masses = new double[this.numberOfParticles];
		this.charges= new double[this.numberOfParticles];
	}
	public int getNumberOfParticles() {
		return numberOfParticles;
	}
	public void setNumberOfParticles(int numberOfParticles) {
		this.numberOfParticles = numberOfParticles;
	}


	public int getDimensions() {
		return dimensions;
	}
	public void setDimensions(int dimensions) {
		this.dimensions = dimensions;
	}

	public double[][] getPositions() {
		return positions;
	}
	public void setPositions(double[][] positions) {
		this.positions = positions;
	}

	public double[] getPosition(int particleNo){ 
		double[] position = new double[this.dimensions];
		
		for(int i=0; i < position.length;i++ ){
			position[i]= this.positions[particleNo][i];
		}
		
		return position;
		}
	public void setPosition(double[] position,int particleNo ){
		for(int i = 0;i<this.dimensions;i++){this.positions[particleNo][i] = position[i];}
	}
	
	
	public double[][] getVelocities() {
		return velocities;
	}
	public void setVelocities(double[][] velocities) {
		this.velocities = velocities;
	}
	
	public double[] getVelocity(int particleNo){ 
		double[] velocity = new double[this.dimensions];
		
		for(int i=0; i < velocity.length;i++ ){
			velocity[i]= this.velocities[particleNo][i];
		}
		
		return velocity;
	} 
		public void setVelocity(double[] velocity,int particleNo ){
		for(int i = 0;i<this.dimensions;i++){this.velocities[particleNo][i] = velocity[i];}
	}
	

	public double[] getMasses() {
		return masses;
	}
	public void setMasses(double[] masses) {
		this.masses = masses;
	}
	public double getMass(int particleNo) {
		return masses[particleNo];
	}
	public void setMass(double mass,int particleNo) {
		this.masses[particleNo] = mass;
	}

	
	public double[] getCharges() {
		return charges;
	}
	public void setCharges(double[] charges) {
		this.charges = charges;
	}
	public double getCharge(int particleNo) {
		return charges[particleNo];
	}
	public void setCharge(double charge,int particleNo) {
		this.charges[particleNo] = charge;
	}
	
}
